<template>
	<view>
		<view class="password pd15">
			<view class="item flexSpace" v-if="configs">
				<view class="left">
					<image src="@/static/my/phone.png" mode="" class="flexIconSmall"></image>
					<view class="label">{{$t('about.contact')}}</view>
				</view>
				<view class="right">
					<text @click="onMakePhone(configs.customer_phone)">{{configs.customer_phone}}</text>
					<image src="@/static/images/arrow-right-icon.png" mode=""></image>
				</view>
			</view>
			<view class="item flexSpace">
				<view class="left"> 
					<image src="@/static/my/pray.png" mode="" class="flexIconSmall"></image>
					<view class="label">{{$t('about.platform')}}</view>
				</view>
				<view class="right" @click="onCopy(configs.customer_wx)">
					<text style="font-size:28rpx;">{{configs.customer_wx}}</text>
					<image src="@/static/my/copy.png" mode="" class="copy"></image>
				</view>
			</view>
			<view class="item flexSpace">
				<view class="left">
					<image src="@/static/my/vision.png" mode="" class="flexIconSmall"></image>
					<view class="label">{{$t('my.version')}}</view>
				</view>
				<view class="right">
					<text>{{version}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {mapState} from 'vuex';
	export default {
		data() {
			return {
              version: '1.0.0'
			}
		},
		computed:{
			...mapState({
				configs:state=>state.config.configs
			})
		},
		created() {
			// #ifdef APP-PLUS
			let _this = this;
			plus.runtime.getProperty(plus.runtime.appid, function(widgetInfo) {
				_this.version = widgetInfo.version;
			});
			// #endif
		},
		methods: {
			onNative(url) {
				uni.navigateTo({
					url: url
				})
			},
			onMakePhone(text) {
				uni.makePhoneCall({
					phoneNumber: text
				});
			},
			onCopy(text) {
				uni.setClipboardData({
					data: text,
					success: function() {
						uni.showToast({
							icon: 'success'
						})
					},
					fail: function() {
						uni.showToast({
							icon: 'fail'
						})
					}
				});
			},
		}
	}
</script>

<style scoped lang="scss">
	.password {
		padding: 0 32rpx;

		.item {
			padding: 32rpx 0;
			border-bottom: .5px solid $hb-line-color;
			align-items: center;

			&:last-child {
				border: 0
			}

			.left {
				display: flex;
				align-items: center;
				.label {
					display: inline-block;
					font-size:34rpx;
					color:$hb-text-black-color;
					margin-left: 20rpx;
				}
			}

			.right {
				font-size:34rpx;
				color:$hb-text-gray-color;
				display: flex;
				align-items: center;
				image {
					width:16rpx;
					height:30rpx;
					display:inline-block;
					margin-left:10rpx;
					&.copy{
						width:24rpx;
						height:24rpx;
					}
				}
			}
		}
	}
</style>
